<!-- 钻孔 -->
<template>
  <el-drawer v-model="addDrawer" size="48%" :show-close="false" @opened="openDrawer" @close="closeDrawer">
    <template #title>
      <el-space direction="vertical" class="space-width100">
        <div v-if="route.path.includes('dataIntegrate') && form.qcOpinion">
          <el-form :model="form" :inline="true" label-width="140px">
            <el-form-item label="质检不通过原因" style="width: 100%">
              <el-input v-model="form.qcOpinion" type="textarea" :autosize="{ minRows: 4, maxRows: 6 }" resize="none"
                clearable></el-input>
            </el-form-item>
          </el-form>
        </div>
        <h2>
          <el-row justify="space-between">
            <span><svg-icon icon-class="list"></svg-icon><span style="padding-left: 15px">{{ typeName }}</span></span>
            <el-button type="primary" @click="confirmClick" :disabled="drawerLoading"
              v-if="isShowSave">保存</el-button>
          </el-row>
        </h2>
      </el-space>
    </template>
    <template #default>
      <el-form :model="form" ref="addRef" :inline="true" :rules="formRules" label-width="160px" v-loading="drawerLoading">
        <el-row justify="space-between">
          <el-form-item label="省">
            <el-input v-model="form.province" clearable disabled></el-input>
          </el-form-item>
          <el-form-item label="市">
            <el-input v-model="form.city" clearable disabled></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="区/县">
            <el-input v-model="form.county" clearable disabled></el-input>
          </el-form-item>
          <el-form-item label="钻孔编号" prop="id">
            <el-input v-model="form.id" placeholder="请输入钻孔编号" clearable maxlength="17"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="工程编号" prop="projectId">
            <el-input v-model="form.projectId" placeholder="请输入工程编号" clearable maxlength="17"></el-input>
          </el-form-item>
          <el-form-item label="钻孔剖面编号" prop="profileId">
            <el-input v-model="form.profileId" placeholder="请输入钻孔剖面编号" clearable maxlength="17"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="野外编号" prop="fieldId" style="width: 100%">
            <el-input v-model="form.fieldId" placeholder="请输入野外编号" clearable :autosize="{ minRows: 2, maxRows: 5 }"
              type="textarea" show-word-limit maxlength="50"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="钻探目的" prop="purpose" style="width: 100%">
            <el-input v-model="form.purpose" placeholder="请输入钻探目的" :autosize="{ minRows: 2, maxRows: 4 }" type="textarea"
              show-word-limit maxlength="40" clearable></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="钻探日期" prop="drillDate">
            <el-input v-model="form.drillDate" placeholder="请输入钻探日期" clearable maxlength="8" />
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="钻探地点" prop="locationName" style="width: 100%">
            <el-input v-model="form.locationName" placeholder="请输入钻探地点" clearable :autosize="{ minRows: 2, maxRows: 4 }"
              type="textarea" show-word-limit maxlength="40" resize="none"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="钻孔来源与类型" prop="drillSource">
            <dict-select code="DrillTypeCVD" :value="form.drillSource" @update="updateDict('drillSource', $event)"></dict-select>
          </el-form-item>
          <el-form-item label="孔位经度" prop="lon">
            <el-input v-model="form.lon" placeholder="请输入孔位经度" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="孔位纬度" prop="lat">
            <el-input v-model="form.lat" placeholder="请输入孔位纬度" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="孔口标高 [米]" prop="elevation">
            <el-input v-model="form.elevation" placeholder="请输入孔口标高 [米]" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="孔深" prop="depth">
            <el-input v-model="form.depth" placeholder="请输入孔深" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="岩芯总长 [米]" prop="coreTotalThickness">
            <el-input v-model="form.coreTotalThickness" placeholder="请输入岩芯总长 [米]" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="全新统厚度 [米]" prop="holoceneThickness">
            <el-input v-model="form.holoceneThickness" placeholder="请输入全新统厚度 [米]" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="上更新统厚度 [米]" prop="upPleiThickness">
            <el-input v-model="form.upPleiThickness" placeholder="请输入上更新统厚度 [米]" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="中更新统厚度 [米]" prop="midPleiThickness">
            <el-input v-model="form.midPleiThickness" placeholder="请输入中更新统厚度 [米]" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="下更新统厚度 [米]" prop="lowPleiThickness">
            <el-input v-model="form.lowPleiThickness" placeholder="请输入下更新统厚度 [米]" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="前第四纪厚度 [米]" prop="prePleiThickness">
            <el-input v-model="form.prePleiThickness" placeholder="请输入前第四纪厚度 [米]" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="采集样品总数" prop="collectedSampleCount">
            <el-input v-model="form.collectedSampleCount" placeholder="请输入采集样品总数" clearable maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="送样总数" prop="sampleCount">
            <el-input v-model="form.sampleCount" placeholder="请输入送样总数" clearable maxlength="4"></el-input>
          </el-form-item>
          <el-form-item label="获得结果样品总数" prop="datingSampleCount">
            <el-input v-model="form.datingSampleCount" placeholder="请输入获得结果样品总数" clearable maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="是否开展地球物理测井" prop="isGeophyWell">
            <dict-select code="TrueOrFalse" :value="form.isGeophyWell" @update="updateDict('isGeophyWell', $event)"></dict-select>
          </el-form-item>
          <el-form-item label="采集环境与工程样品数" prop="collectedEnviromentSampleCount">
            <el-input v-model="form.collectedEnviromentSampleCount" placeholder="请输入采集环境与工程样品数" clearable
              maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="环境与工程样品送样总数" prop="enviromentSampleCount">
            <el-input v-model="form.enviromentSampleCount" placeholder="请输入环境与工程样品送样总数" clearable
              maxlength="4"></el-input>
          </el-form-item>
          <el-form-item label="获得测试结果的环境与工程样品数" prop="testedEnviromentSampleCount">
            <el-input v-model="form.testedEnviromentSampleCount" placeholder="请输入获得测试结果的环境与工程样品数" clearable
              maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="钻孔柱状图图像文件编号" prop="columnChartAiid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.columnChartAiid" placeholder="请输入钻孔柱状图图像文件编号" clearable maxlength="20"></el-input>
            </el-space>
          </el-form-item>
          <el-form-item label=" " prop="columnChartAiidId" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <ImageUpload v-model="form.columnChartAiidName" @uploadImage="uploadSuccess('columnChartAiid', $event)" @delFile="deleteFile('columnChartAiid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="钻孔柱状图原始档案编号" prop="columnChartArwid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.columnChartArwid" placeholder="请输入钻孔柱状图原始档案编号" clearable maxlength="20"></el-input>
            </el-space>
          </el-form-item>
          <el-form-item label=" " prop="columnChartArwidId" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <FileUpload v-model="form.columnChartArwidName" @uploadFile="uploadSuccess('columnChartArwid', $event)" @delFile="deleteFile('columnChartArwid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="岩芯照片图像档案编号" prop="corePhotoAiid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.corePhotoAiid" placeholder="请输入岩芯照片图像档案编号" clearable maxlength="20"></el-input>
              <ImageUpload v-model="form.corePhotoAiidName" @uploadImage="uploadSuccess('corePhotoAiid', $event)" @delFile="deleteFile('corePhotoAiid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="岩芯照片原始档案编号" prop="corePhotoArwid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.corePhotoArwid" placeholder="请输入岩芯照片原始档案编号" clearable maxlength="20"></el-input>
            </el-space>
          </el-form-item>
          <el-form-item label=" " prop="corePhotoArwidId" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <FileUpload v-model="form.corePhotoArwidName" @uploadFile="uploadSuccess('corePhotoArwid', $event)" @delFile="deleteFile('ilGraphArwid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="钻孔班报编号" prop="drillingLogAiid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.drillingLogAiid" placeholder="请输入钻孔班报编号" clearable maxlength="20"></el-input>
              <ImageUpload v-model="form.drillingLogAiidName" @uploadImage="uploadSuccess('drillingLogAiid', $event)" @delFile="deleteFile('drillingLogAiid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="钻孔班报原始文件编号" prop="drillingLogArwid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.drillingLogArwid" placeholder="请输入钻孔班报原始文件编号" clearable maxlength="20"></el-input>
              <FileUpload v-model="form.drillingLogArwidName" @uploadFile="uploadSuccess('drillingLogArwid', $event)" @delFile="deleteFile('drillingLogArwid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="简易水文观测记录表" prop="hydroRecordAiid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.hydroRecordAiid" placeholder="请输入简易水文观测记录表" clearable maxlength="20"></el-input>
              <ImageUpload v-model="form.hydroRecordAiidName" @uploadImage="uploadSuccess('hydroRecordAiid', $event)" @delFile="deleteFile('hydroRecordAiid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="简易水文观测记录表原始" prop="hydroRecordArwid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.hydroRecordArwid" placeholder="请输入简易水文观测记录表原始" clearable maxlength="20"></el-input>
              <FileUpload v-model="form.hydroRecordArwidName" @uploadFile="uploadSuccess('hydroRecordArwid', $event)" @delFile="deleteFile('hydroRecordArwid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="采样记录表编号" prop="geologySmplRecAiid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.geologySmplRecAiid" placeholder="请输入采样记录表编号" clearable maxlength="20"></el-input>
              <ImageUpload v-model="form.geologySmplRecAiidName" @uploadImage="uploadSuccess('geologySmplRecAiid', $event)" @delFile="deleteFile('geologySmplRecAiid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="采样记录表原始文件编号" prop="geologySmplRecArwid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.geologySmplRecArwid" placeholder="请输入采样记录表原始文件编号" clearable maxlength="20"></el-input>
              <FileUpload v-model="form.geologySmplRecArwidName" @uploadFile="uploadSuccess('geologySmplRecArwid', $event)" @delFile="deleteFile('geologySmplRecArwid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="钻孔孔深检查编号" prop="depthCheckAiid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.depthCheckAiid" placeholder="请输入钻孔孔深检查编号" clearable maxlength="20"></el-input>
              <ImageUpload v-model="form.depthCheckAiidName" @uploadImage="uploadSuccess('depthCheckAiid', $event)" @delFile="deleteFile('depthCheckAiid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="钻孔孔深检查原始文件编号" prop="depthCheckArwid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.depthCheckArwid" placeholder="请输入钻孔孔深检查原始文件编号" clearable maxlength="20"></el-input>
              <FileUpload v-model="form.depthCheckArwidName" @uploadFile="uploadSuccess('depthCheckArwid', $event)" @delFile="deleteFile('depthCheckArwid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="井斜测量结果登记表文件编号" prop="wellClinationAiid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.wellClinationAiid" placeholder="请输入井斜测量结果登记表文件编号" clearable maxlength="20"></el-input>
              <ImageUpload v-model="form.wellClinationAiidName" @uploadImage="uploadSuccess('wellClinationAiid', $event)" @delFile="deleteFile('wellClinationAiid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="井斜测量结果登记表原始文件编号" prop="wellClinationArwid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.wellClinationArwid" placeholder="请输入井斜测量结果登记表原始文件编号" clearable maxlength="20"></el-input>
              <FileUpload v-model="form.wellClinationArwidName" @uploadFile="uploadSuccess('wellClinationArwid', $event)" @delFile="deleteFile('wellClinationArwid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="原始岩芯编录表图像文件编号" prop="coreCatalogAiid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.coreCatalogAiid" placeholder="请输入原始岩芯编录表图像文件编号" clearable maxlength="20"></el-input>
              <ImageUpload v-model="form.coreCatalogAiidName" @uploadImage="uploadSuccess('coreCatalogAiid', $event)" @delFile="deleteFile('coreCatalogAiid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="原始岩芯编录表原始" prop="coreCatalogArwid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.coreCatalogArwid" placeholder="请输入原始岩芯编录表原始" clearable maxlength="20"></el-input>
              <FileUpload v-model="form.coreCatalogArwidName" @uploadFile="uploadSuccess('coreCatalogArwid', $event)" @delFile="deleteFile('coreCatalogArwid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="封孔设计及封孔报告书文件编号" prop="sealDesignReportArid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.sealDesignReportArid" placeholder="请输入封孔设计及封孔报告书文件编号" clearable maxlength="20"></el-input>
              <FileUpload v-model="form.sealDesignReportAridName" @uploadFile="uploadSuccess('sealDesignReportArid', $event)" @delFile="deleteFile('sealDesignReportArid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="封孔设计及封孔报告书原始文件编号" prop="sealDesignReportArwid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.sealDesignReportArwid" placeholder="请输入封孔设计及封孔报告书原始文件编号" clearable maxlength="20"></el-input>
              <FileUpload v-model="form.sealDesignReportArwidName" @uploadFile="uploadSuccess('sealDesignReportArwid', $event)" @delFile="deleteFile('sealDesignReportArwid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="钻孔质量验收报告文件编号" prop="sealCheckArid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.sealCheckArid" placeholder="请输入钻孔质量验收报告文件编号" clearable maxlength="20"></el-input>
              <FileUpload v-model="form.sealCheckAridName" @uploadFile="uploadSuccess('sealCheckArid', $event)" @delFile="deleteFile('sealCheckArid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="钻孔质量验收报告原始文件编号" prop="sealCheckArwid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.sealCheckArwid" placeholder="请输入钻孔质量验收报告原始文件编号" clearable maxlength="20"></el-input>
              <FileUpload v-model="form.sealCheckArwidName" @uploadFile="uploadSuccess('sealCheckArwid', $event)" @delFile="deleteFile('sealCheckArwid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="钻孔描述" prop="commentInfo" style="width:100%">
            <el-input v-model="form.commentInfo" placeholder="请输入钻孔描述" :autosize="{ minRows: 6, maxRows: 12 }"
              type="textarea" show-word-limit maxlength="2147483647" clearable></el-input>
          </el-form-item>
        </el-row>
      </el-form>
    </template>
  </el-drawer>
</template>
<script setup>
import useSpatialData from '@/hooks/useSpatialData'
import { eightDouble, fourInt } from '@/utils/validate'
const { route, addDrawer, drawerLoading, form, typeName, openDrawer, closeDrawer, confirmClick, uploadSuccess, deleteFile, updateDict, isShowSave } = useSpatialData()
const formRules = {
  id: [{ required: true, message: '请填写钻孔编号！', trigger: 'blur' }],
  projectId: [{ required: true, message: '请填写工程编号！', trigger: 'blur' }],
  fieldId: [{ required: true, message: '请填写野外编号！', trigger: 'blur' }],
  purpose: [{ required: true, message: '请填写钻探目的！', trigger: 'blur' }],
  drillDate: [{ required: true, message: '请填写钻探日期！', trigger: 'blur' }],
  locationName: [{ required: true, message: '请填写钻探地点！', trigger: 'blur' }],
  lon: [{ required: true, message: '请填写孔位经度！', trigger: 'blur' }, eightDouble],
  lat: [{ required: true, message: '请填写孔位纬度！', trigger: 'blur' }, eightDouble],
  elevation: [{ required: true, message: '请填写孔口标高 [米]！', trigger: 'blur' }, eightDouble],
  depth: [{ required: true, message: '请填写孔深！', trigger: 'blur' }, eightDouble],
  coreTotalThickness: [{ required: true, message: '请填写岩芯总长 [米]！', trigger: 'blur' }, eightDouble],
  holoceneThickness: [eightDouble],
  upPleiThickness: [eightDouble],
  midPleiThickness: [eightDouble],
  lowPleiThickness: [eightDouble],
  prePleiThickness: [eightDouble],
  sampleCount: [{ required: true, message: '请填写送样总数！', trigger: 'blur' }, fourInt],
  datingSampleCount: [{ required: true, message: '请填写获得结果样品总数！', trigger: 'blur' }, fourInt],
  isGeophyWell: [{ required: true, message: '请填写是否开展地球物理测井！', trigger: 'blur' }],
  collectedEnviromentSampleCount: [fourInt],
  enviromentSampleCount: [{ required: true, message: '请填写环境与工程样品送样总数！', trigger: 'blur' }, fourInt],
  testedEnviromentSampleCount: [{ required: true, message: '请填写获得测试结果的环境与工程样品数！', trigger: 'blur' }, fourInt],
  columnChartAiid: [{ required: true, message: '请填写钻孔柱状图图像文件编号！', trigger: 'blur' }],
  columnChartAiidId: [{ required: true, message: '请上传钻孔柱状图图像文件编号附件！', trigger: 'blur' }],
  columnChartArwid: [{ required: true, message: '请填写钻孔柱状图原始档案编号！', trigger: 'blur' }],
  columnChartArwidId: [{ required: true, message: '请填写钻孔柱状图原始档案编号附件！', trigger: 'blur' }],
  corePhotoArwid: [{ required: true, message: '请填写岩芯照片原始档案编号！', trigger: 'blur' }],
  corePhotoArwidId: [{ required: true, message: '请填写岩芯照片原始档案编号附件！', trigger: 'blur' }],
}
</script>
<style scoped></style>